//
//  YWNewDetailKeepWatchMissionCell.m
//  maintain
//
//  Created by 郑想 on 16/7/25.
//  Copyright © 2016年 ewin. All rights reserved.
//

#import "YWKeepWatchMissionDetailCell.h"
#import "UIColor+CustomColors.h"
#import "UIImageView+WebCache.h"
#import "Masonry.h"
//#import "UILabel+AttributedText.h"
#import "YWMacro.h"
#import "YWCommonTool.h"
#import "YYLabel.h"

#import "YWHandler.h"
#import "YWBuilding.h"
#import "YWBuildingManager.h"
#import "YWKeepWatchMission.h"
#import "YWKeepWatchMissionManager.h"
#import "YWReplyManager.h"

@interface YWKeepWatchMissionDetailCell()
/** 头像 */
@property (strong, nonatomic) UIImageView *headImageView;
/** 发布者 */
@property (strong, nonatomic) YYLabel *responseNameLabel;
/** 发布时间 */
@property (strong, nonatomic) YYLabel *createTimeLabel;
/** 编号 */
@property (strong, nonatomic) YYLabel *numberLabel;
/** 巡更人 */
@property (strong, nonatomic) YYLabel *inspectionManLabel;
/** 巡更位置 */
@property (strong, nonatomic) YYLabel *inspectionSiteLabel;
/** 巡更路线 */
@property (strong, nonatomic) YYLabel *inspectionRoutLabel;
/** 要求 */
@property (strong, nonatomic) YYLabel *noteLabel;
/** 巡更日 */
@property (strong, nonatomic) YYLabel *inspectionDay;
/** 开始时间 */
@property (strong, nonatomic) YYLabel *startTimeLabel;
/** 结束时间 */
@property (strong, nonatomic) YYLabel *endTimeLabel;
/** 每日巡更时间 */
@property (strong, nonatomic) YYLabel *daylyInspectionTimeLabel;
/** 巡更间隔 */
@property (strong, nonatomic) YYLabel *inspectionIntervalLabel;
/** 当前巡更时间 */
@property (strong, nonatomic) YYLabel *nowInspectionTimeLabel;
/** 已完成 */
@property (strong, nonatomic) YYLabel *hasFinishLabel;
///** 评论图标 */
//@property (strong, nonatomic) UIImageView *replyIcon;
///** 评论数量 */
//@property (strong, nonatomic) YYLabel *replyNumberLabel;
///** 参与者图标 */
//@property (strong, nonatomic) UIImageView *observerIcon;
///** 参与者数量 */
//@property (strong, nonatomic) YYLabel *observerNumberLabel;
@end

@implementation YWKeepWatchMissionDetailCell

+ (instancetype)cellWithTableView:(UITableView *)tableView
{
    YWKeepWatchMissionDetailCell *cell = [tableView dequeueReusableCellWithIdentifier:YWKeepWatchMissionDetailCellIdentifier];
    if (cell == nil) {
        cell = [[YWKeepWatchMissionDetailCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:YWKeepWatchMissionDetailCellIdentifier];
    }
    return cell;
}

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.layer.shouldRasterize = YES;
        self.layer.rasterizationScale = [UIScreen mainScreen].scale;
        [self setUpSubviews];
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.separatorInset = UIEdgeInsetsMake(0, SCREEN_WIDTH, 0, 0);
    }
    return self;
}

- (void)setKeepWatchMission:(YWKeepWatchMission *)keepWatchMission{
    _keepWatchMission = keepWatchMission;
    NSString* downloadUrl = [YWCommonTool pictureDownloadUrl:_keepWatchMission.creator.headIcon];
    [_headImageView sd_setImageWithURL:[NSURL URLWithString:downloadUrl] placeholderImage:[UIImage imageNamed:@"profile_headimage"]];
    //    制定人
    _responseNameLabel.text = _keepWatchMission.creator.userName;
    //制定时间
    _createTimeLabel.text = [YWCommonTool showTimeWithNormalFormatter:_keepWatchMission.createTime / 1000];
    //    巡更人
    NSString *executors = [YWCommonTool handlerNamesWithHandlers:keepWatchMission.executors];
    _inspectionManLabel.attributedText = [YWCommonTool attributedTextWithFirstText:NSLocalizedString(@"keepWatchExecutor", nil) firstColor:[UIColor customTextGrayBlackColor] secondText:executors.length?executors:NSLocalizedString(@"none", nil) secondColor:[UIColor customYellowColor] font:kContentFont];
    
    [self setupKeepWatchMission:keepWatchMission];
}

- (void)setPatrolLineRecord:(YWPatrollineRecord *)patrolLineRecord{
    _patrolLineRecord = patrolLineRecord;
    NSString* downloadUrl = nil;
    if (patrolLineRecord.executors.count==1) {
        YWHandler *handler = patrolLineRecord.executors[0];
        downloadUrl = [YWCommonTool pictureDownloadUrl:handler.headIcon];
    }
    [_headImageView sd_setImageWithURL:[NSURL URLWithString:downloadUrl] placeholderImage:[UIImage imageNamed:@"profile_headimage"]];
    //    巡更人
    _responseNameLabel.text = patrolLineRecord.result == YWPatrollineRecordResultSystem ? NSLocalizedString(@"noManToKeepWatch", nil) : ([YWCommonTool handlerNamesWithHandlers:patrolLineRecord.executors]?:NSLocalizedString(@"none", nil));
    //制定时间
    _createTimeLabel.text = [YWCommonTool showTimeWithNormalFormatter:patrolLineRecord.endTime / 1000];
    //  创建人
    NSString *creator = patrolLineRecord.keepWatchMission.creator.userName;
    _inspectionManLabel.attributedText = [YWCommonTool attributedTextWithFirstText:NSLocalizedString(@"creatorFormatter", nil) firstColor:[UIColor customTextGrayBlackColor] secondText:creator.length?creator:NSLocalizedString(@"none", nil) secondColor:[UIColor customYellowColor] font:kContentFont];
    
    [self setupKeepWatchMission:patrolLineRecord.keepWatchMission];
}

- (void)setupKeepWatchMission:(YWKeepWatchMission*)keepWatchMission{
    //编号
    //[_numberLabel labelText:@"编号: " withAttributedText:keepWatchMission.missionSequence.length>0?keepWatchMission.missionSequence:@"无" andAttributedColor:[UIColor customYellowColor]];
    NSString *numberText = keepWatchMission.missionSequence.length>0?keepWatchMission.missionSequence:NSLocalizedString(@"none", nil);
    _numberLabel.attributedText = [YWCommonTool attributedTextWithFirstText:NSLocalizedString(@"codeFormatter", nil) firstColor:[UIColor customTextGrayBlackColor] secondText:numberText secondColor:[UIColor customYellowColor] font:kContentFont];
    
    //    楼盘名称
    YWBuilding* buliding = nil;
    if (keepWatchMission.buildingId.length) {
        buliding = [[YWBuildingManager shareManager] buildingWithId:keepWatchMission.buildingId];
    }else{
        YWPatrolLineLocationRel *locationRel = keepWatchMission.patrolLine.locationRels.count>0?keepWatchMission.patrolLine.locationRels[0]:nil;
        buliding = [[YWBuildingManager shareManager] buildingWithLocationId:locationRel.locationId];
    }
    //[_inspectionSiteLabel labelText:@"位置: " withAttributedText:buliding.buildingName.length>0?buliding.buildingName:@"无" andAttributedColor:[UIColor blackColor]];
    NSString *locationText = buliding.buildingName.length>0?buliding.buildingName:NSLocalizedString(@"none", nil);
    _inspectionSiteLabel.attributedText = [YWCommonTool attributedTextWithFirstText:NSLocalizedString(@"locationFormatter", nil) firstColor:[UIColor customTextGrayBlackColor] secondText:locationText secondColor:[UIColor blackColor] font:kContentFont];
    
    //路线名
    NSString *lineName = keepWatchMission.patrolLine.patrolLineId==0 ? NSLocalizedString(@"tempKeepWatch", nil) : (keepWatchMission.patrolLine.patrolLineName?keepWatchMission.patrolLine.patrolLineName:NSLocalizedString(@"none", nil));
    //[_inspectionRoutLabel labelText:@"路线: " withAttributedText:lineName andAttributedColor:[UIColor blackColor]];
    _inspectionRoutLabel.attributedText = [YWCommonTool attributedTextWithFirstText:NSLocalizedString(@"lineFormatter", nil) firstColor:[UIColor customTextGrayBlackColor] secondText:lineName secondColor:[UIColor blackColor] font:kContentFont];
    
    //要求
    //[_noteLabel labelText:@"要求: " withAttributedText:keepWatchMission.patrolLine.note.length>0?keepWatchMission.patrolLine.note:@"无" andAttributedColor:[UIColor blackColor]];
    NSString *noteText = keepWatchMission.patrolLine.note.length>0?keepWatchMission.patrolLine.note:NSLocalizedString(@"none", nil);
    _noteLabel.attributedText = [YWCommonTool attributedTextWithFirstText:NSLocalizedString(@"demandFormatter", nil) firstColor:[UIColor customTextGrayBlackColor] secondText:noteText secondColor:[UIColor blackColor] font:kContentFont];
    
    //巡更日
    NSString *weekStr = @"";
    for (YWPatrolLineWeekRel *weekRel in keepWatchMission.patrolLine.weekRels) {
        weekStr = [weekStr stringByAppendingString:[YWCommonTool weekDayString:weekRel.week]];
        weekStr = [weekStr stringByAppendingString:@","];
    }
    weekStr = weekStr.length>=1?[weekStr substringToIndex:weekStr.length-1]:NSLocalizedString(@"none", nil);
    //[_inspectionDay labelText:@"巡更日: " withAttributedText:weekStr andAttributedColor:[UIColor blackColor]];
    _inspectionDay.attributedText = [YWCommonTool attributedTextWithFirstText:NSLocalizedString(@"keepWatchDayFormatter", nil) firstColor:[UIColor customTextGrayBlackColor] secondText:weekStr secondColor:[UIColor blackColor] font:kContentFont];
    
    //开始时间
    NSString *startDate = keepWatchMission.startDate ? [YWCommonTool showTime:keepWatchMission.startDate/1000 andFormatter:KTimeFormatShortDate] : NSLocalizedString(@"none", nil);
    //[_startTimeLabel labelText:@"开始日期: " withAttributedText:startDate andAttributedColor:[UIColor blackColor]];
    _startTimeLabel.attributedText = [YWCommonTool attributedTextWithFirstText:NSLocalizedString(@"startDateFormatter", nil) firstColor:[UIColor customTextGrayBlackColor] secondText:startDate secondColor:[UIColor blackColor] font:kContentFont];
    
    //结束时间
    NSString *endDate = keepWatchMission.endDate ? [YWCommonTool showTime:keepWatchMission.endDate/1000 andFormatter:KTimeFormatShortDate] : NSLocalizedString(@"none", nil);
    //[_endTimeLabel labelText:@"结束日期: " withAttributedText:endDate andAttributedColor:[UIColor blackColor]];
    _endTimeLabel.attributedText = [YWCommonTool attributedTextWithFirstText:NSLocalizedString(@"endDateFormatter", nil) firstColor:[UIColor customTextGrayBlackColor] secondText:endDate secondColor:[UIColor blackColor] font:kContentFont];
    
    //每日巡更时间
    //[_daylyInspectionTimeLabel labelText:@"每日巡更: " withAttributedText:[NSString stringWithFormat:@"%@ - %@",keepWatchMission.startTime.length?keepWatchMission.startTime:@"",keepWatchMission.endTime.length?keepWatchMission.endTime:@""] andAttributedColor:[UIColor blackColor]];
    NSString *dayInspectText = [NSString stringWithFormat:@"%@ - %@",keepWatchMission.startTime.length?keepWatchMission.startTime:@"",keepWatchMission.endTime.length?keepWatchMission.endTime:@""];
    _daylyInspectionTimeLabel.attributedText = [YWCommonTool attributedTextWithFirstText:NSLocalizedString(@"keepWatchTimeByDay", nil) firstColor:[UIColor customTextGrayBlackColor] secondText:dayInspectText secondColor:[UIColor blackColor] font:kContentFont];
    
    //巡更间隔
    NSString *timeStr = keepWatchMission.keepWatchMissionId ? [YWCommonTool minuteToHourOrDayString:keepWatchMission.patrolLine.intervalMinute] : NSLocalizedString(@"none", nil);
    //[_inspectionIntervalLabel labelText:@"巡更间隔: " withAttributedText:timeStr andAttributedColor:[UIColor blackColor]];
    _inspectionIntervalLabel.attributedText = [YWCommonTool attributedTextWithFirstText:NSLocalizedString(@"keepWatchIntervalFormatter", nil) firstColor:[UIColor customTextGrayBlackColor] secondText:timeStr secondColor:[UIColor blackColor] font:kContentFont];
    
    //当前巡更时间
    NSString *timeString = NSLocalizedString(@"none", nil);
    if (keepWatchMission.keepWatchMissionId) {
        NSArray *looperTimeArray = keepWatchMission.currentLooperTimeArray.count ? keepWatchMission.currentLooperTimeArray : [YWCommonTool looperTimeArrayWithMission:keepWatchMission];
        NSTimeInterval lineRecordStarTime = (looperTimeArray.count>0?[[looperTimeArray firstObject] longLongValue]:0);
        NSTimeInterval lineRecordEndTime = (looperTimeArray.count>0?[[looperTimeArray lastObject] longLongValue]:0);
        NSString *startTime = nil;
        NSString *endTime = nil;
        if (keepWatchMission.patrolLine.intervalMinute>24*60) {
            startTime = [YWCommonTool showTime:lineRecordStarTime andFormatter:KTimeFormatShortDate];
            endTime = [YWCommonTool showTime:lineRecordEndTime andFormatter:KTimeFormatShortDate];
        }else{
            startTime = [YWCommonTool showTime:lineRecordStarTime andFormatter:KTimeFormatShortTime];
            endTime = [YWCommonTool showTime:lineRecordEndTime andFormatter:KTimeFormatShortTime];
        }
        timeString = (lineRecordStarTime==0 && lineRecordEndTime==0) ? NSLocalizedString(@"notWorkTime", nil) :[NSString stringWithFormat:@"%@ - %@",startTime,endTime];
    }
    
    //[_nowInspectionTimeLabel labelText:@"当前巡更: " withAttributedText:timeString andAttributedColor:[UIColor customYellowColor]];
    _nowInspectionTimeLabel.attributedText = [YWCommonTool attributedTextWithFirstText:NSLocalizedString(@"currentKeepWatchTime", nil) firstColor:[UIColor customTextGrayBlackColor] secondText:timeString secondColor:[UIColor customYellowColor] font:kContentFont];
    
    //已完成
    NSInteger count = 1;//临时的是1个点
    if (keepWatchMission.keepWatchMissionId) {
        NSString *uniqueTag = [YWCommonTool uniqueTagWithMission:keepWatchMission];
        count = [[YWKeepWatchMissionManager shareManager] countOfPatrolPointRecordWithUniqueTag:uniqueTag];
    }
    //[_hasFinishLabel labelText:@"已完成: " withAttributedText:[NSString stringWithFormat:@"%ld个",(long)count] andAttributedColor:[UIColor customYellowColor]];
    NSString *finishText = [NSString stringWithFormat:@"%ld个",(long)count];
    _hasFinishLabel.attributedText = [YWCommonTool attributedTextWithFirstText:@"已完成: " firstColor:[UIColor customTextGrayBlackColor] secondText:finishText secondColor:[UIColor customYellowColor] font:kContentFont];
    
//    //    评论
//    NSInteger replyCount = [[YWReplyManager shareManager] replysCountWithtRelationId:keepWatchMission.keepWatchMissionId relationType:YWReplyRelationTypeKeepWatch];
//    _replyNumberLabel.text = [@(replyCount) stringValue];
//    //参与者
//    NSInteger observerCount = keepWatchMission.executors.count;
//    NSInteger uniqueId = keepWatchMission.creator.uniqueId;
//    NSPredicate *searchPredicate = [NSPredicate predicateWithFormat:@"%K = %ld", @"uniqueId", uniqueId];
//    NSArray *array = [[keepWatchMission.executors filteredArrayUsingPredicate:searchPredicate] mutableCopy];
//    if (array.count==0) {
//        observerCount++;
//    }
//    if (keepWatchMission.observers.count>0) {
//        observerCount = observerCount + keepWatchMission.observers.count;
//    }
//    _observerNumberLabel.text = [@(observerCount) stringValue];
    
    
    self.inspectionManLabel.preferredMaxLayoutWidth = self.inspectionManLabel.frame.size.width;
    self.inspectionSiteLabel.preferredMaxLayoutWidth = self.inspectionSiteLabel.frame.size.width;
    self.inspectionRoutLabel.preferredMaxLayoutWidth = self.inspectionRoutLabel.frame.size.width;
    self.noteLabel.preferredMaxLayoutWidth = self.noteLabel.frame.size.width;
    self.inspectionDay.preferredMaxLayoutWidth = self.inspectionDay.frame.size.width;
}

- (void)setUpSubviews{
    UIView *superview = self.contentView;
    /**
     *  头像 名字
     *  头像 时间
     */
    [self.headImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.and.top.mas_equalTo(superview).offset(8);
        make.width.and.height.mas_equalTo(@46);
    }];
    
    [self.responseNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(_headImageView.mas_centerY).offset(-2);
        make.left.mas_equalTo(_headImageView.mas_right).offset(6);
    }];
    
    [self.createTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(_responseNameLabel);
        make.top.mas_equalTo(_responseNameLabel.mas_bottom).offset(4);
    }];
    /**
     *  编号
     *  巡更人
     *  位置
     *  路线
     *  要求
     *  巡更日
     */
    
    [self.numberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_headImageView.mas_bottom).offset(6);
        make.left.mas_equalTo(superview).offset(8);
        make.right.mas_equalTo(superview).offset(-8);
    }];
    
    [self.inspectionManLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_numberLabel.mas_bottom).offset(6);
    }];
    
    [self.inspectionSiteLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_inspectionManLabel.mas_bottom).offset(6);
        
    }];
    
    [self.inspectionRoutLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_inspectionSiteLabel.mas_bottom).offset(6);
    }];
    
    [self.noteLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_inspectionRoutLabel.mas_bottom).offset(6);
    }];
    
    [self.inspectionDay mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_noteLabel.mas_bottom).offset(6);
        make.left.and.right.mas_equalTo(@[_numberLabel,_inspectionManLabel , _inspectionSiteLabel, _inspectionRoutLabel, _noteLabel]);
    }];
    /**
     *  开始日期    结束日期
     *  每日巡更    巡更间隔
     *  当前巡更    已完成
     */
    [self.startTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_inspectionDay.mas_bottom).offset(6);
        make.right.mas_equalTo(superview.mas_centerX).offset(30);
    }];
    
    
    [self.daylyInspectionTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_startTimeLabel.mas_bottom).offset(6);
    }];
    
    
    [self.nowInspectionTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_daylyInspectionTimeLabel.mas_bottom).offset(6);
        make.left.mas_equalTo(@[_numberLabel, _startTimeLabel, _daylyInspectionTimeLabel]);
        make.right.mas_equalTo(@[_startTimeLabel, _daylyInspectionTimeLabel]);
        make.bottom.mas_equalTo(superview.mas_bottom).offset(-6);
//        make.bottom.mas_equalTo(self.replyIcon.mas_top).offset(-6);
    }];
    
    [self.endTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.baseline.mas_equalTo(_startTimeLabel);
        make.left.mas_equalTo(superview.mas_centerX).offset(30);
        make.right.mas_equalTo(superview.mas_right).offset(-8);
    }];
    
    [self.inspectionIntervalLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.baseline.mas_equalTo(_daylyInspectionTimeLabel);
    }];
    [self.hasFinishLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.baseline.mas_equalTo(_nowInspectionTimeLabel);
        make.left.and.right.mas_equalTo(@[_endTimeLabel, _inspectionIntervalLabel]);
    }];
//    [self.replyIcon mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.bottom.mas_equalTo(superview);
//        make.width.mas_equalTo(@23);
//        make.height.mas_equalTo(@23);
//    }];
//    [self.replyNumberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.mas_equalTo(_replyIcon.mas_top);
//        make.left.mas_equalTo(_replyIcon.mas_right).offset(8);
//        make.right.mas_equalTo(superview.mas_right).offset(-15);
//        make.bottom.mas_equalTo(_replyIcon.mas_bottom);
//        make.width.mas_lessThanOrEqualTo(@80);
//    }];
//    [self.observerIcon mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.bottom.mas_equalTo(superview);
//        make.width.mas_equalTo(@23);
//        make.height.mas_equalTo(@23);
//    }];
//    [self.observerNumberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.mas_equalTo(_observerIcon.mas_top);
//        make.left.mas_equalTo(_observerIcon.mas_right).offset(8);
//        make.right.mas_equalTo(_replyIcon.mas_left).offset(-15);
//        make.bottom.mas_equalTo(_observerIcon.mas_bottom);
//        make.width.mas_lessThanOrEqualTo(@80);
//    }];
}

//- (void)layoutSubviews{
//    [super layoutSubviews];
//   
//}

- (UIImageView *)headImageView{
    if (!_headImageView) {
        UIImageView *imageView = [UIImageView new];
        imageView.layer.masksToBounds = YES;
        imageView.layer.cornerRadius = 46/2;
        _headImageView = imageView;
        [self.contentView addSubview:_headImageView];
    }
    return _headImageView;
}

- (YYLabel *)responseNameLabel{
    if (!_responseNameLabel) {
        YYLabel *label = [[YYLabel alloc] init];
        label.font = kContentFont;
        label.textColor = [UIColor blackColor];
        _responseNameLabel = label;
        [self.contentView addSubview:_responseNameLabel];
    }
    return _responseNameLabel;
}

- (YYLabel *)createTimeLabel{
    if (!_createTimeLabel) {
        YYLabel *label = [[YYLabel alloc] init];
        label.font = kContentFont;
        label.textColor = [UIColor customTextGrayBlackColor];
        _createTimeLabel = label;
        [self.contentView addSubview:_createTimeLabel];
    }
    return _createTimeLabel;
}

- (YYLabel *)numberLabel{
    if (!_numberLabel) {
        YYLabel *label = [[YYLabel alloc] init];
        label.font = kContentFont;
        label.textColor = [UIColor customTextGrayBlackColor];
        _numberLabel = label;
        [self.contentView addSubview:_numberLabel];
    }
    return _numberLabel;
}

- (YYLabel *)inspectionManLabel{
    if (!_inspectionManLabel) {
        YYLabel *label = [[YYLabel alloc] init];
        label.font = kContentFont;
        label.numberOfLines = 0;
        label.textColor = [UIColor customTextGrayBlackColor];
        _inspectionManLabel = label;
        [self.contentView addSubview:_inspectionManLabel];
    }
    return _inspectionManLabel;
}

- (YYLabel *)inspectionSiteLabel{
    if (!_inspectionSiteLabel) {
        YYLabel *label = [[YYLabel alloc] init];
        label.font = kContentFont;
        label.numberOfLines = 0;
        label.textColor = [UIColor customTextGrayBlackColor];
        _inspectionSiteLabel = label;
        [self.contentView addSubview:_inspectionSiteLabel];
    }
    return _inspectionSiteLabel;
}

- (YYLabel *)inspectionRoutLabel{
    if (!_inspectionRoutLabel) {
        YYLabel *label = [[YYLabel alloc] init];
        label.font = kContentFont;
        label.numberOfLines = 0;
        label.textColor = [UIColor customTextGrayBlackColor];
        _inspectionRoutLabel = label;
        [self.contentView addSubview:_inspectionRoutLabel];
    }
    return _inspectionRoutLabel;
}

- (YYLabel *)noteLabel{
    if (!_noteLabel) {
        YYLabel *label = [[YYLabel alloc] init];
        label.font = kContentFont;
        label.numberOfLines = 0;
        label.textColor = [UIColor customTextGrayBlackColor];
        _noteLabel = label;
        [self.contentView addSubview:_noteLabel];
    }
    return _noteLabel;
}

- (YYLabel *)inspectionDay{
    if (!_inspectionDay) {
        YYLabel *label = [[YYLabel alloc] init];
        label.font = kContentFont;
        label.numberOfLines = 0;
        label.textColor = [UIColor customTextGrayBlackColor];
        _inspectionDay = label;
        [self.contentView addSubview:_inspectionDay];
    }
    return _inspectionDay;
}

- (YYLabel *)startTimeLabel{
    if (!_startTimeLabel) {
        YYLabel *label = [[YYLabel alloc] init];
        label.font = kContentFont;
        label.textColor = [UIColor customTextGrayBlackColor];
        _startTimeLabel = label;
        [self.contentView addSubview:_startTimeLabel];
    }
    return _startTimeLabel;
}

- (YYLabel *)endTimeLabel{
    if (!_endTimeLabel) {
        YYLabel *label = [[YYLabel alloc] init];
        label.font = kContentFont;
        label.textColor = [UIColor customTextGrayBlackColor];
        _endTimeLabel = label;
        [self.contentView addSubview:_endTimeLabel];
    }
    return _endTimeLabel;
}

- (YYLabel *)daylyInspectionTimeLabel{
    if (!_daylyInspectionTimeLabel) {
        YYLabel *label = [[YYLabel alloc] init];
        label.font = kContentFont;
        label.textColor = [UIColor customTextGrayBlackColor];
        _daylyInspectionTimeLabel = label;
        [self.contentView addSubview:_daylyInspectionTimeLabel];
    }
    return _daylyInspectionTimeLabel;
}

- (YYLabel *)inspectionIntervalLabel{
    if (!_inspectionIntervalLabel) {
        YYLabel *label = [[YYLabel alloc] init];
        label.font = kContentFont;
        label.textColor = [UIColor customTextGrayBlackColor];
        _inspectionIntervalLabel = label;
        [self.contentView addSubview:_inspectionIntervalLabel];
    }
    return _inspectionIntervalLabel;
}

- (YYLabel *)nowInspectionTimeLabel{
    if (!_nowInspectionTimeLabel) {
        YYLabel *label = [[YYLabel alloc] init];
        label.font = kContentFont;
        label.textColor = [UIColor customTextGrayBlackColor];
        _nowInspectionTimeLabel = label;
        [self.contentView addSubview:_nowInspectionTimeLabel];
    }
    return _nowInspectionTimeLabel;
}

- (YYLabel *)hasFinishLabel{
    if (!_hasFinishLabel) {
        YYLabel *label = [[YYLabel alloc] init];
        label.font = kContentFont;
        label.textColor = [UIColor customTextGrayBlackColor];
        _hasFinishLabel = label;
        [self.contentView addSubview:_hasFinishLabel];
    }
    return _hasFinishLabel;
}

//- (YYLabel *)replyNumberLabel{
//    if (!_replyNumberLabel) {
//        YYLabel *label = [[YYLabel alloc] init];
//        label.font = kContentFont;
//        label.textColor = [UIColor customTextGrayBlackColor];
//        _replyNumberLabel = label;
//        [self.contentView addSubview:_replyNumberLabel];
//    }
//    return _replyNumberLabel;
//}
//
//- (UIImageView *)replyIcon{
//    if (!_replyIcon) {
//        UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"remind_replyIcon"]];
//        _replyIcon = imageView;
//        [self.contentView addSubview:_replyIcon];
//    }
//    return _replyIcon;
//}
//
//- (UIImageView *)observerIcon{
//    if (!_observerIcon) {
//        UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"common_members"]];
//        _observerIcon = imageView;
//        [self.contentView addSubview:_observerIcon];
//    }
//    return _observerIcon;
//}
//
//- (YYLabel *)observerNumberLabel{
//    if (!_observerNumberLabel) {
//        YYLabel *label = [[YYLabel alloc] init];
//        label.font = kContentFont;
//        label.textColor = [UIColor customTextGrayBlackColor];
//        _observerNumberLabel = label;
//        [self.contentView addSubview:_observerNumberLabel];
//    }
//    return _observerNumberLabel;
//}

@end
